/*
 * Copyright 2020 wangruiCoder owner
 */

package org.disk.frame.logger.config;

import org.disk.frame.logger.interceptor.HttpLogInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 类描述
 * <p>详细描述</p>
 *
 * @author kyrie 2021/4/21 6:40 下午
 * @since jdk1.8
 */
public class HttpLogInterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new HttpLogInterceptor(applicationContext)).addPathPatterns("/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
